/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.rec.be;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "REC_CARTERA")
@NamedQueries({@NamedQuery(name = "Cartera.findAll", query = "SELECT c FROM Cartera c"), @NamedQuery(name = "Cartera.findByIdCartera", query = "SELECT c FROM Cartera c WHERE c.idCartera = :idCartera"), @NamedQuery(name = "Cartera.findByEstadoCartera", query = "SELECT c FROM Cartera c WHERE c.estadoCartera = :estadoCartera"), @NamedQuery(name = "Cartera.findByAnotaciones", query = "SELECT c FROM Cartera c WHERE c.anotaciones = :anotaciones"), @NamedQuery(name = "Cartera.findByResponsable", query = "SELECT c FROM Cartera c WHERE c.responsable = :responsable"), @NamedQuery(name = "Cartera.findByFechaRegistro", query = "SELECT c FROM Cartera c WHERE c.fechaRegistro = :fechaRegistro"), @NamedQuery(name = "Cartera.findByFechaActualizacion", query = "SELECT c FROM Cartera c WHERE c.fechaActualizacion = :fechaActualizacion")})
public class Cartera implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CARTERA", nullable = false)
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long idCartera;
    @Column(name = "ESTADO_CARTERA", length = 10)
    private String estadoCartera;
    @Column(name = "ANOTACIONES", length = 50)
    private String anotaciones;
    @Column(name = "RESPONSABLE", length = 50)
    private String responsable;
    @Column(name = "FECHA_REGISTRO")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaRegistro;
    @Column(name = "FECHA_ACTUALIZACION")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaActualizacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cartera", fetch = FetchType.LAZY)
    private List<CreditoCartera> creditoCarteraList;
    @OneToMany(mappedBy = "fidRecCartera", fetch = FetchType.LAZY)
    private List<HistorialCrediticio> historialCrediticioList;

    public Cartera() {
    }

    public Cartera(Long idCartera) {
        this.idCartera = idCartera;
    }

    public Long getIdCartera() {
        return idCartera;
    }

    public void setIdCartera(Long idCartera) {
        this.idCartera = idCartera;
    }

    public String getEstadoCartera() {
        return estadoCartera;
    }

    public void setEstadoCartera(String estadoCartera) {
        this.estadoCartera = estadoCartera;
    }

    public String getAnotaciones() {
        return anotaciones;
    }

    public void setAnotaciones(String anotaciones) {
        this.anotaciones = anotaciones;
    }

    public String getResponsable() {
        return responsable;
    }

    public void setResponsable(String responsable) {
        this.responsable = responsable;
    }

    public Date getFechaRegistro() {
        return fechaRegistro;
    }

    public void setFechaRegistro(Date fechaRegistro) {
        this.fechaRegistro = fechaRegistro;
    }

    public Date getFechaActualizacion() {
        return fechaActualizacion;
    }

    public void setFechaActualizacion(Date fechaActualizacion) {
        this.fechaActualizacion = fechaActualizacion;
    }

    public List<CreditoCartera> getCreditoCarteraList() {
        return creditoCarteraList;
    }

    public void setCreditoCarteraList(List<CreditoCartera> creditoCarteraList) {
        this.creditoCarteraList = creditoCarteraList;
    }

    public List<HistorialCrediticio> getHistorialCrediticioList() {
        return historialCrediticioList;
    }

    public void setHistorialCrediticioList(List<HistorialCrediticio> historialCrediticioList) {
        this.historialCrediticioList = historialCrediticioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCartera != null ? idCartera.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cartera)) {
            return false;
        }
        Cartera other = (Cartera) object;
        if ((this.idCartera == null && other.idCartera != null) || (this.idCartera != null && !this.idCartera.equals(other.idCartera))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.rec.be.Cartera[idCartera=" + idCartera + "]";
    }

}
